package hz.mobileproject.pda.toolsmanager.adapter;

import android.content.Context;
import android.view.View;
import android.widget.TextView;

import com.blankj.utilcode.util.TimeUtils;

import org.xutils.view.annotation.ViewInject;

import java.util.ArrayList;
import java.util.Date;

import hz.mobileproject.pda.R;
import hz.mobileproject.pda.toolsmanager.bean.response.RP_Small_Manage;
import hz.mobileproject.pda.ui.base.BaseCustomAdapter;

/**
 * Created by Lc on 2018/1/30.
 */

public class SmallManageAdapter extends BaseCustomAdapter<RP_Small_Manage,SmallManageAdapter.SearchVH> {


    public SmallManageAdapter(Context mContext, ArrayList<RP_Small_Manage> list) {
        super(mContext, list);
    }

    @Override
    protected int bindView() {
        return R.layout.item_small_manage;
    }

    @Override
    protected SearchVH createViewHolder() {
        return new SearchVH();
    }

    @Override
    protected void bindData(int position, View convertView, SearchVH vh) {
        RP_Small_Manage bean = mList.get(position);
        vh.tv_dp.setText(bean.dept_name);
        vh.tv_jinban.setText(bean.person_name);
        vh.tv_shiyong.setText(bean.use_person_name);
        vh.tv_tool_bh.setText(bean.tool_id);
        vh.tv_tool_name.setText(bean.tool_name);
        if("1".equals(bean.type)) {
            vh.tv_banli_lx.setText("发放");
        }else if("2".equals(bean.type)) {
            vh.tv_banli_lx.setText("收回");
        }else if("3".equals(bean.type)) {
            vh.tv_banli_lx.setText("报废");
        }

        vh.tv_banli_time.setText(TimeUtils.date2String(new Date(Long.parseLong(bean.time))));

    }

    class SearchVH{
        @ViewInject(R.id.tv_dp)
        private TextView tv_dp;

        @ViewInject(R.id.tv_jinban)
        private TextView tv_jinban;
        @ViewInject(R.id.tv_shiyong)
        private TextView tv_shiyong;
        @ViewInject(R.id.tv_tool_bh)
        private TextView tv_tool_bh;
        @ViewInject(R.id.tv_tool_name)
        private TextView tv_tool_name;
        @ViewInject(R.id.tv_banli_lx)
        private TextView tv_banli_lx;
        @ViewInject(R.id.tv_banli_time)
        private TextView tv_banli_time;


    }
}
